table of contents
GIT-LFS-FETCH(1) | GIT-LFS-FETCH(1) |
NAME¶
git-lfs-fetch - Download all Git LFS files for a given ref
SYNOPSIS¶
git lfs fetch [options] [<remote> [<ref>...]]
DESCRIPTION¶
Download Git LFS objects at the given refs from the specified remote. See DEFAULT REMOTE and DEFAULT REFS for what happens if you don’t specify.
This does not update the working copy.
OPTIONS¶
-I <paths>, --include=<paths>
-X <paths>, --exclude=<paths>
--recent
--all
--prune, -p
INCLUDE AND EXCLUDE¶
You can configure Git LFS to only fetch objects to satisfy references in certain paths of the repo, and/or to exclude certain paths of the repo, to reduce the time you spend downloading things you do not use.
In your Git configuration or in a .lfsconfig file, you may set either or both of lfs.fetchinclude and lfs.fetchexclude to comma-separated lists of paths. If lfs.fetchinclude is defined, Git LFS objects will only be fetched if their path matches one in that list, and if lfs.fetchexclude is defined, Git LFS objects will only be fetched if their path does not match one in that list. Paths are matched using wildcard matching as per gitignore(5).
Note that using the command-line options -I and -X override the respective configuration settings. Setting either option to an empty string clears the value.
Examples¶
This will only fetch objects referenced in paths in the textures folder, and files called foo* in the images folder
Only fetch JPG/PNG/TGA files, wherever they are in the repository
Don’t fetch any LFS objects referenced in the folder media/reallybigfiles, but fetch everything else
Only fetch LFS objects in the 'media' folder, but exclude those in one of its subfolders.
DEFAULT REMOTE¶
Without arguments, fetch downloads from the default remote. The default remote is the same as for git fetch, i.e. based on the remote branch you’re tracking first, or origin otherwise.
DEFAULT REFS¶
If no refs are given as arguments, the currently checked out ref is used. In addition, if enabled, recently changed refs and commits are also included. See RECENT CHANGES for details.
RECENT CHANGES¶
If the --recent option is specified, or if the gitconfig option lfs.fetchrecentalways is true, then after the current ref (or those in the arguments) is fetched, we also search for 'recent' changes to fetch objects for, so that it’s more convenient to checkout or diff those commits without incurring further downloads.
What changes are considered 'recent' is based on a number of gitconfig options:
lfs.fetchrecentrefsdays
lfs.fetchrecentremoterefs
lfs.fetchrecentcommitsdays
lfs.fetchrecentalways
EXAMPLES¶
git lfs fetch
git lfs fetch --recent
git lfs fetch upstream
git lfs fetch --all origin main develop
git lfs fetch origin mybranch
git lfs fetch origin main mybranch e445b45c1c9c6282614f201b62778e4c0688b5c8
SEE ALSO¶
git-lfs-checkout(1), git-lfs-pull(1), git-lfs-prune(1), gitconfig(5).
Part of the git-lfs(1) suite.